<template>
	<view>
		<view class="expert-friend-apply-pop-mask" v-show="maskShow"></view>
		<expert-friend-apply-content v-for="(item,index) in msgList" :key="item.id" :shareData="item" @close="cleanMsgList"></expert-friend-apply-content>
	</view>
</template>

<script>
	import expertFriendApplyContent from './expertFriendApplyContent.vue'
	export default {
		components:{
			expertFriendApplyContent
		},
		data() {
			return {
				msgList:[]
			}
		},
		computed:{
			maskShow(){
				return this.msgList.length > 0
			}
		},
		mounted() {
			
		},
		methods: {
			show(data){
				data.id = +new Date()
				this.msgList.push(data)
				// this.msgList = [data] // 只同时存在一条的情况
			},
			cleanMsgList(id){
				this.msgList = this.msgList.filter(item => {
					return item.id !== id
				})
			},
			hide(){
				this.msgList = []
			}
		}
	}
</script>


<style lang="less" scoped>
	.expert-friend-apply-pop-mask {
		position: fixed;
		top: 0;
		left: 0;
		width: 100%;
		height: 100%;
		background-color: rgba(0, 0, 0, 0.3);
		z-index: 99;
		animation: fadeIn 0.3s forwards;
	}
	
	@keyframes fadeIn {
		0% {
			opacity: 0;
		}
	
		100% {
			opacity: 1;
		}
	}
	
</style>
